﻿using System.Web;

namespace MvcWechat.Common
{
    public class ManagerSession
    {
        /// <summary>
        /// 创建Session
        /// </summary>
        /// <param name="sessionName"></param>
        /// <param name="value"></param>
        public static void SetSession(string sessionName,object value)
        {
            HttpContext.Current.Session[sessionName] = value;
        }

        /// <summary>
        /// 获取Session
        /// </summary>
        public static string GetSession(string sessionName)
        {
            if (HttpContext.Current.Session[sessionName] != null)
            {
                return HttpContext.Current.Session[sessionName] as string;
            }
            return string.Empty;
        }

        /// <summary>
        /// 移除Session
        /// </summary>
        /// <param name="sessionName"></param>
        public static void RemoveSession(string sessionName)
        {
            HttpContext.Current.Session.Remove(sessionName);
        }


    }
}